package top.stmo.blog.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.stmo.blog.dao.vo.Result;
import top.stmo.blog.dao.vo.params.CommentParam;
import top.stmo.blog.service.CommentsService;

@RestController
@RequestMapping("/comments")
public class CommentsController {

    @Autowired
    private CommentsService commentsService;

    @GetMapping("/article/{id}")
    public Result comments(@PathVariable("id") Long id) {

        return commentsService.commentsByArticleId(id);
    }

    @PostMapping("/create/change")
    public Result comment(@RequestBody CommentParam commentParam) {

        return commentsService.comment(commentParam);
    }

}
